package com.zbcz.erp.activity

import android.os.Bundle
import com.bumptech.glide.Glide
import com.zbcz.erp.databinding.ActivityFullScreenImageBinding
import com.zbcz.erp.util.DensityUtils
import com.zbcz.erp.util.onSingleClick

class FullScreenImageViewActivity : BaseActivity() {

    companion object {
        const val IMAGE_URL = "IMAGE_URL"
    }

    private lateinit var mBinding: ActivityFullScreenImageBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        mBinding = ActivityFullScreenImageBinding.inflate(layoutInflater)
        setContentView(mBinding.root)
        init()
        super.onCreate(savedInstanceState)
    }

    fun init() {
        mBinding.clParent.setPadding(
            0,
            DensityUtils.dp2px(this, 48f),
            0,
            0
        )
        mBinding.clTitle.ivCommonBack.onSingleClick {
            finish()
        }
        mBinding.clTitle.tvTitle.text = "图片预览"
        intent?.getStringExtra(IMAGE_URL)?.let { imageUrl ->
            Glide.with(this)
                .load(imageUrl)
                .into(mBinding.ivImage)
        }
    }
}